<?php
   
   class Editor{
   	  
	 private $type;      //editor类型，默认为完整版
	 
	 private $minFrameHeight = 200; //editor高度，默认为200
	 
	 private $maxWords = 10000;  //editor编辑字数，默认为10000字
	 
	 private $textareaname;  //编辑器的名称，用于表单提交的name处理
   	 
	 public function __construct($textareaname ,$type="complete"){
	 	$this->type     = $type;
		$this->textareaname = $textareaname;
	 }
	 
	 public function setMinFrameHeight($minFrameHeight){
	 	$this->minFrameHeight = $minFrameHeight;
	 }
	 
	 public function setmaxWords($maxWords){
	 	$this->maxWords = $maxWords;
	 }
	 
	 public function getHeaderHtml(){
	 	return '<script type="text/javascript" charset="utf-8" src="view/global/ueditor/editor_config.js"></script>
	 			<script type="text/javascript" charset="utf-8" src="view/global/ueditor/editor_all_min.js"></script>
			    <script type="text/javascript" charset="utf-8" src="view/global/ueditor/editor_api.js">
			        paths = [
			            "editor.js",
			            "core/browser.js",
			            "core/utils.js",
			            "core/EventBase.js",
			            "core/dom/dom.js",
			            "core/dom/dtd.js",
			            "core/dom/domUtils.js",
			            "core/dom/Range.js",
			            "core/dom/Selection.js",
			            "core/Editor.js",
			            "commands/inserthtml.js",
			            "commands/image.js",
			            "commands/insertimage.js",
			            "commands/justify.js",
			            "commands/font.js",
			            "commands/link.js",
			            "commands/removeformat.js",
			            "commands/blockquote.js",
			            "commands/indent.js",
			            "commands/print.js",
			            "commands/preview.js",
			            "commands/selectall.js",
			            "commands/paragraph.js",
			            "commands/directionality.js",
			            "commands/horizontal.js",
			            "commands/time.js",
			            "commands/inserthtml.js",
			            "commands/rowspacing.js",
			            "commands/cleardoc.js",
			            "commands/anchor.js",
			            "commands/delete.js",
			            "commands/wordcount.js",
			            "plugins/pagebreak/pagebreak.js",
			            "plugins/undo/undo.js",
			            "plugins/paste/paste.js",
			            "plugins/list/list.js",
			            "plugins/source/source.js",
			            "plugins/shortcutkeys/shortcutkeys.js",
			            "plugins/enterkey/enterkey.js",
			            "plugins/keystrokes/keystrokes.js",
			            "plugins/fiximgclick/fiximgclick.js",
			            "plugins/autolink/autolink.js",
			            "plugins/autoheight/autoheight.js",
			            "plugins/autofloat/autofloat.js",  //依赖UEditor UI,在IE6中，会覆盖掉body的背景图属性
			            "plugins/highlight/highlight.js",
			            "plugins/serialize/serialize.js",
			            "plugins/video/video.js",
			            "plugins/table/table.js",
			            "plugins/contextmenu/contextmenu.js",
			            "plugins/pagebreak/pagebreak.js",
			            "plugins/basestyle/basestyle.js",
			            "plugins/elementpath/elementpath.js",
			            "plugins/formatmatch/formatmatch.js",
			            "plugins/searchreplace/searchreplace.js",
			            "ui/ui.js",
			            "ui/uiutils.js",
			            "ui/uibase.js",
			            "ui/separator.js",
			            "ui/mask.js",
			            "ui/popup.js",
			            "ui/colorpicker.js",
			            "ui/tablepicker.js",
			            "ui/stateful.js",
			            "ui/button.js",
			            "ui/splitbutton.js",
			            "ui/colorbutton.js",
			            "ui/tablebutton.js",
			            "ui/toolbar.js",
			            "ui/menu.js",
			            "ui/combox.js",
			            "ui/dialog.js",
			            "ui/menubutton.js",
			            "ui/datebutton.js",
			            "ui/editorui.js",
			            "ui/editor.js",
			            "ui/multiMenu.js"
			        ];
			    </script>
			    <link rel="stylesheet" type="text/css" href="view/global/ueditor/themes/default/ueditor.css"/>';
	 }
	 
	 public function getEditorHtml(){
			return '<script type="text/javascript">
					    var editor = new baidu.editor.ui.Editor({
							UEDITOR_HOME_URL:"view/global/ueditor/",
					        iframeCssUrl :"view/global/ueditor/themes/default/iframe.css",
					        minFrameHeight:'.$this->minFrameHeight.',
					        maximumWords:'.$this->maxWords.',
					        textarea:"'.$this->textareaname.'"
					    });
					    editor.render("'.$this->textareaname.'");
					</script>';
		 
	 }
	 
   }





?>